package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/10/07 20:12
 **/
public class Day35_1_Num1800_MaxAscendingSum {
    class Solution {
        public int maxAscendingSum(int[] nums) {
            int ans = 0, sum = 0, n = nums.length;
            for (int i = 0; i < n; i++) {
                if (i == 0 || nums[i] > nums[i - 1]) {
                    sum += nums[i];
                } else {
                    sum = nums[i];
                }
                ans = Math.max(ans, sum);
            }
            return ans;
        }
    }
}